Example to set .bk to highlight as a bash file
vim /etc/vimrc
Syntax on
au BufNewFile,BufRead *.bk set filetype=bash
Create your own syntax on a custom extension (raw) in this example
Create the syntax file ~/.vim/syntax/raw.vim
" Vim syntax file
" Language: jlweber raw files
" Maintainer: Jean-Louis Girard
" Latest Revision: 2018-08-16
if exists("b:current_syntax")
finish
endif
" Regions
" remove the escapes for code
syn region jlcode start='<\code>' end='<\/code>'
syn region jlh1 start='' end='
'
syn region jlh2 start='' end='
'
syn region jlh3 start='' end='
'
Create the filetype for vim ~/.vim/ftdetect/raw.vim
autocmd BufRead,BufNewFile *.raw set filetype=raw
Add the desired colors to the region matches in .vimrc
set t_Co=256
highlight jlcode ctermfg=39
highlight jlh1 ctermfg=172
highlight jlh2 ctermfg=178
highlight jlh3 ctermfg=184