Quoted from Slate:
"Islam emphasizes modesty and simplicity, but some of Mohammed's sayings (or hadith) recommend covering up gray hair with henna or a dye called katam. According to the hadith of Sahih Bukhari, this would set Muslims apart from Jews and Christians, who (according to Mohammed) didn't dye their hair. The prophet said to avoid black hair coloring, however, probably because you weren't supposed to try to mimic a natural hue.
The Quran says nothing on the subject of keeping beards, but believers are urged to follow the example of the prophets, who all had them. Mohammed in particular maintained a neat, groomed appearance, and scholars believe he trimmed his facial hair. The general guideline from Sahih Bukhari boils down to "Trim the mustache, keep the beard." Followers should cut their mustaches short enough that the skin above the upper lip is visible, and grow beards to at least a fistful in length. A longer beard isn't automatically better, though. According to one account in the hadith of Malik's Muwatta, the prophet sent a man with disheveled hair out of the mosque to groom his beard. Muslims must also refrain from trimming their hair during the hajj, or pilgrimage to Mecca—at least until they've walked seven times around the Kaaba. "