The uniform section of the cba doesn't mention grooming, nor does the player contract, where in either document do teams get that power?
The manager makes the rules. If they apply to anyone, they are reasonable, and they don't violate a person's rights (ie, against their religion to cut their hair) then they're good to go.
The player's contract usually has some sort of catch all wording about proper appearance and conduct.