You'll need a versioned datastore and a diffing algorithm.
Store versions of your resources by giving each resource a revision number. When a user edits a resource, instead of replacing the resource, save the edit as a new entry in your datastore with a new, higher revision number. When you want to retrieve the resource, return the one with the highest revision.
Instead of a revision number you could use timestamps. Not only do timestamps always increase, but the revision number itself could be used to identify when the resource was modified.
Choose a diff algorithm based on how you're storing the resources. Wikitext is usually linewise, so if users are editing that, it would make sense to use a linewise diff like the standard Unix diff
utility. If the resources are XML, you may wish to find an XML-specific diff algorithm so that it would be clear to users where the differences are.