Support for comments was added by https://github.com/ClusterLabs/pacemaker/pull/349.
Ideally we should ignore comments when generating XML patchsets, and perhaps when applying them. Pacemaker obviously doesn't care about the comments. Our patchset/diff tools don't need to be general-purpose. Rather, they need to meet Pacemaker's needs and the needs of legitimate Pacemaker-specific use cases for end users.
I'm not sure what complications might arise from ignoring comments. The PR description says
Previously, if there's a XML comment in a diff, when the diff is being applied, the resulted XML will get a "" element instead of the correct comment. That will violate the schema.
However, supporting comments has complicated our XML code *substantially*. Most of the position-related code, including storing the position in a pcmk__deleted_xml_t, exists just for comments. The XML node matching code has become very complicated because a comment is considered a match only if the positions match in the old and new XML. And so on.
We can simplify a LOT of things if we simply exclude comments from our diffs.
However, technically this breaks backward compatibility. We need to decide how much we care and whether to do this at a minor release, or what.