I would like to add specific custom header in more general match (e.g. "^comp.") and add no such custom header in more specific match (e.g. "^comp.mail."). How to do it?
This seems to be a good case for Gnus Posting Styles.
(
("^comp."
("X-Custom-Header" "Custom Stuff"))
("^comp.more.specific"
("X-Custom-Header" nil)))
If the value is nil
the header will be removed. See one of the paragraphs in the huge wall of text that I linked above.