Can I add a custom attribute to an HTML tag like the following?
You can amend your !DOCTYPE declaration (i.e. DTD) to allow it, so that the [XML] document will still be valid:
]>
#IMPLIED means it is an optional attribute, or you could use #REQUIRED, etc.
#IMPLIED
#REQUIRED
More information is in DTD - Attributes.