It's generally believed that the rapid temperature change in your mouth stimulates the surrounding nerves to rapidly dilate the neighboring blood vessels to try and counteract the temperature change. In so doing, those same nerves also stimulate pain--not just your blood vessels. Touching your tongue to the roof of your mouth is supposed to make the pain go away faster, but also--and this seems counterintuitive--keeping your mouth cold between sips seems to help. It's the rapid dilation of the blood vessels causing it; so if they're already dilated, you don't get as much pain the next time.
My SO doesn't get brain freeze. It's so unfair. But--for some reason, she is unable to roll her R's, such as "perro" in Spanish. I don't know if there's a biological connection there. It seems like the same nerves which cause pain can also control your tongue in that way. She doesn't get the pain, but...she can't control her tongue that way, either. Next time I see a neurosurgeon, I will ask (which is probably never...).