If you choose the option to write .xmp data, then yes those changes are written to the .dng file. Otherwise, they are stored only in the database.
(Be careful... there are some posts indicating that even though some users have turned on write to .xmp... they are finding that it doesn't in some cases.)
Also, after you turn on that option it may take awhile to actually do that for all images in your library... and you apparently also take a performance hit when that option is turned on.
Also from LR forum... LR is sometimes a bit over-zealous in writing out the .xmp data... sometimes it does it when nothing has really changed.
Also, also, also
Note that the data written to .xmp while it does include the LR "changes" it does NOT include the history of those changes, or virtual copies, (and some other settings (flags?)) Those are only contained in the catalog itself.
All in all, it may not be a bad idea to back up the catalog occasionally when you backup your images.