FAQ
Why must zsh-syntax-highlighting.zsh be sourced at the end of the .zshrc file?
zsh-syntax-highlighting.zsh wraps ZLE widgets. It must be sourced after all custom widgets have been created (i.e., after all zle -N calls and after running compinit). Widgets created later will work, but will not update the syntax highlighting.
As per https://github.com/zsh-users/zsh-syntax-highlighting: