I think the reason why comments on her hairstyle can be considered as sexual harassment is because they were "an unsolicited appraisal of another person's physical appearance" which is an overt expression of the fact that he was ogling her, i.e. objectifying her.
While saying "ponytail definitely suits you" is miles away from something like "those are damn fine tits" it's still well within the realm of objectification and some people may still feel uncomfortable hearing it.
In short, saying compliments based on another person's physical appearance is practically a less obvious form of catcalling and should be avoided in most cases.