The actual script fromWhat the "shrunken head" actually says in the film is (emphasis mine):
Shrunken Head: "I say! No underage wizards allowed in today! Shut the damn door!"
So it was only on that particular day, or that particular time, that underage wizards weren't allowed in the Three Broomsticks, and there's no contradiction with the fact that Hogwarts students go in there all the time on other days.
As for the reason, it probably had to do with the meeting going on in there between the Minister for Magic and some of the teachers. While they were discussing the ins and outs of the case of the (supposed) mass murderer Sirius Black, they wouldn't want random kids overhearing their conversation. Especially one Mr Harry Potter, although as things turned out, their precautions were rather useless on that score...
(It should be noted that this whole "shrunken heads" business is pointless nonsense made up for the films, and has no basis in canon.)