You can often fix it with `:syntax sync fromstart`, but Vim's syntax highlighting just keeps being a bit weird.
:noremap <silent> <Space> :silent noh <Bar>echo<cr>:syn sync fromstart<cr>
This recalculates syntax highlighting as well as removes highlighting on search results/etc.Basically, whenever stuff "looks weird", just mash space in normal mode and it fixes it. The fact that I have this bound to something like space should tell you how often I end up using it. :)
I guess fromstart would work as well, but is probably best manually run like you do so a very large file doesn't bring the system to a halt.