The Wikimedia engine does something like this. The way they mark changes is a little bit different, but you might try taking a look at the source and see if it gives you any clues. I'm anticipating a similar project in my not too distant future, so if you do come up with a good solution, please share :)