How to use custom font for codes in Quick Look?
Removed the erroneous suggestion that it was Xcode font settings that provided this functionality.  

You can find out which application is responsible for displaying source code in QuickLook by using this command in the terminal:

qlmanage -m plugins | grep -i "public.source-code"

If nothing shows up you don't have an application that provides this functionality.

In that case you can try this quicklook plugin https://github.com/anthonygelibert/QLColorCode.