I'm not entirely clear on what you are asking, but I can offer some basics.
The easiest way to compare two strings in PHP is with strcmp():
http://us3.php.net/manual/en/function.strcmp.php
It makes what is called a "binary-safe" string comparison. What that means is that if you use strcmp, it looks at the binary values of the strings -- not what physically appears on the screen -- and sees if they are exactly the same values.
Another effective way to compare strings is with hashes -- short codes that can be generated to compare the values of two strings or two files.
Most commonly, that's done with the MD5 hash algorithm:
http://us3.php.net/manual/en/function.md5.php
http://us3.php.net/manual/en/function.md5-file.php
In the case of wikis, their DB storage engines generally handle watching the changes and storing them; by storing each revision as a record in the database, you can easily track changes across the lifetime of an article.
You can see how MediaWiki (Wikipedia) does this here:
http://www.mediawiki.org/wiki/Revision_table