Minimal example:
\documentclass{article}
\usepackage{minted}
\usepackage{syntax}
\begin{document}
\begin{minted}{some_thing}
foo
\end{minted}
\end{document}
When compiling with Miktex/pdflatex, I get
! Missing \endcsname inserted.
<to be read again>
\protect
l.8 \begin{minted}{some_thing}
So far, I have figured out that the underscore in some_thing is the problem. This is only a problem when I add the syntax package. Note that the best case here is still an error: Package minted Error: Missing Pygments output;. The argument in question is supposed to point to a file. The example is really contrived, sorry.
So I guess I need to escape the underscore somehow? Just going some\_thing gives me the same error. I guess command arguments are somehow different. What can I do here?