This seems to be done by an extraordinarily smart guy - Neil
Fraser. He's behind "google-diff-match-patch" [1] project,
which is AFAIK the machinery behind realtime collaboration
on google docs.
I've worked with Neil, and he is indeed extraordinary. I'd say he's who I want to be when I grow up except it's not clear he's grown up. See, for example, the centrifuge in his living room (http://neil.fraser.name/hardware/centrifuge/).
Not a big fan of what amounts to fairly typical coding via drag and drop, but this is a fantastic resource. I have a project in my queue that will need Google Doc collab functionality so this is very useful. Cheers.
Definitely worth watching.
[1] http://code.google.com/p/google-diff-match-patch/