How do you customize merged component inspectors?

When I select more than one item in the hierarchy the inspector shows a ‘merged’ transform component (and others) that changes the value for all selected items. How can I customize that merged view, for example adding a button like I can on individual transforms

Same way you customise any inspector, with a custom UnityEditor.Editor inspector, or PropertyDrawer.

Just involves writing code that considers whether more than one object is selected or not, which can easily be checked by using SerializedObject.isEditingMultipleObjects.