XMP data is the data that Adobe software (ACR and LR) creates to store the editing that you do to a Raw file. The truth is, we really don't need to think about XMP data at all - it just does its thing in the background, and we get on with our lives. But it confuses some people, especially when they see those little XMP files in their folders, so let me explain a bit more.
It's very important to understand that Raw files themselves are absolutely, impenetrably, rock-solidly, unchangeable. You can't modify a raw file, no matter what you try. The ones and zeros of Raw data that come out of your camera will never be altered.
So, when you're editing a Raw file, you're not actually changing the file itself. Rather, you're making cosmetic changes to its appearance - much the same as dressing yourself. You might be dressing in work clothes, or casual clothes, or gardening clothes; but underneath, your body is the same. Your external appearance is being modified by your garments, that's all.
So it is with Raw files. You might "dress" a Raw file with a warmer white balance, or reduced exposure, or whatever. But underneath, it's still exactly the same Raw data, and therefore it's as easy as pie to "undress" it again later if you wish to start your editing all over (more about this later).
The visual modifications you make to the Raw file have to be saved somewhere, of course, and since the Raw data itself can never be altered in any way, the editing information has to be saved beside it. That's the XMP data.
When Adobe Camera Raw users edit their Raw files, then press "Done" or "Open" or "Save", the XMP data is saved as a separate .xmp file alongside the Raw file in its folder. When I look at a folder of Raw files on my computer, I can see at a glance which ones I've already edited, because they have the XMP file beside them:
In Lightroom, the XMP data is constantly updated as you edit, and saved inside LR's catalogue, unless you change the preference to tell it to save externally. That change seems like a good idea to me, so I encourage LR users to read this article. Once you change that preference, LR behaves the same as ACR, and puts XMP files beside the Raw files in their folder on your hard drive.
The exception to all of this is the DNG format. DNG files have an extra "pocket" to contain the XMP data inside them, so no additional file is necessary. (Some people love this about DNG, others loathe it. I am in the latter category, and I wrote in my last post about why I eschew DNG files.) So, if you're a DNG user, you won't see XMP files in your folders, the way I can in mine.
Please understand that you don't need to do anything to save XMP data. There's no File>Save As, or File>Export, or anything like that. The XMP data just gets saved automatically while you're doing your work. It's a wonderfully automatic process that we don't even need to think about 99% of the time.
I must also mention that you can't open an XMP file, and nor do you need to. If you double-click on one, you'll just get a "Can't open" error message, or maybe it'll open in a text editing program as a whole bunch of gibberish. I can't read gibberish, and I bet you can't either ... but your Adobe software can, and that's all that matters.
Needless to say, XMP files are very important, so don't delete them carelessly, and don't move them into a separate folder from their Raw files. If you do either of those things, then open your Raw file, all of your previous editing will have disappeared, and your image will be "naked" again.
That brings me to my last topic of discussion - things you can do with an XMP file. (Again, this doesn't apply to DNG users - they can play with their XMP data, but it's more complex, and I won't discuss it here.)
The most obvious one is when you don't like your edit, and want to start again. If you've got the file open in your program at the time, then you can just reset your edits. But if it's not open, and you're browsing the folder of Raw files, just delete the XMP file. Bam! Next time you open that Raw file, it'll be back to its original state.
More commonly, though, you will probably decide not to delete it, but just to rename it. This has the same effect of returning the Raw file to its unedited state, but with the added bonus that if you don't like your second attempt at editing better than your first, you can simple re-rename it back to the correct file name, and there's your edit again. If renaming isn't your thing, you can just move the XMP file into another folder (eg your desktop), and move it back again if necessary.
(This isn't necessary with Lightroom, I think, because LR has a good system of "virtual copies".)
So, that's about all there is to tell you about XMP. I hope it has cleared up a few things for you. Of course, if you have more questions, visit us at Ask Damien.