You might think that a dimmer turns down the lights by turning down the power flow. But it actually works like a super-fast strobe, switching the power on and off dozens of times per second. This electrical pulsation causes the filaments in light bulbs to vibrate and that creates the humming sound you hear. An easy solution—which usually works—is to try different brands of bulbs. Some bulbs have beefier filaments, which vibrate less.
You can even try “rough-use” bulbs meant for garage-door openers or trouble lights. These bulbs have heavy filaments but are several times the cost of regular bulbs. If bulb switcheroo doesn't stop the hum, upgrade your dimmer switch. High quality, more expensive dimmers usually dampen the electrical pulse better than the inexpensive types. Swapping out a dimmer switch is usually a simple matter of disconnecting and reconnecting three wires. Just be sure to work safely. Turn off the power to the circuit—and make sure it's off using a non-contact voltage detector.