При выделении Markdown (https://github.com/plasticboy/vim-markdown/blob/master/syntax/mkd.vim) plasticboy делает это так:
"HTML headings
syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell
syn region htmlH2 start="^\s*##" end="\($\|#\+\)" contains=@Spell
syn region htmlH3 start="^\s*###" end="\($\|#\+\)" contains=@Spell
syn region htmlH4 start="^\s*####" end="\($\|#\+\)" contains=@Spell
syn region htmlH5 start="^\s*#####" end="\($\|#\+\)" contains=@Spell
syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contains=@Spell
syn match htmlH1 /^.\+\n=\+$/ contains=@Spell "<-- Here is the one I think you want
syn match htmlH2 /^.\+\n-\+$/ contains=@Spell
Для полноты заголовки Markdown имеют вид:
H1 header
=========
H2 header
---------