If the .cm-hashtag is inside the heading, you could use the child selector to specify “tag inside heading”. I don’t know the actual markup (I know it can be weird in Live Preview), but something like
h1 > .cm-hashtag,
h2 > .cm-hashtag {
Unfortunately CSS doesn’t provide a way to select headings in general, so you’ll have to specify every level (I only included the first 2).