I have had this behaviour occasionally, but I’ve always just let it be, as its only affected me while editing very large files.
However, now you’ve brought it up I went looking for a solution. I found this page: http://vim.wikia.com/wiki/Fix_syntax_highlighting, which has the following command:
:syntax sync fromstart
Running that solves it for me, although it does take a while to complete.
Edit: Following that page’s suggestion to use minlines argument, I’ve found that I get instantaneous and usually-correct highlighting by running this command instead:
:syntax sync minlines=20
But obviously you can play with the value to trade-off speed and accuracy to your own taste.