Just an idea how (simplistic) document comparison can be implemented.
- Extract the body text from 2 (or more) open documents' Document Object Model (DOM) in-memory structure into 2 strings
- Strip out formatting markups and unnecessary whitespaces from the strings
- Apply a text diff library (from some open source projects?) to compare the 2 strings
- Loop through the list of differences (perhaps an enumeration or list) to add some comments at the side