Inexplicable error after importing syntax package

The Syntax package redefines the underscore character, so when you use it in filenames it is not read as it is but interpreted as a macro and expanded. Simple solution: avoid underscore in filenames.

Not so pretty solution: capture the original underscore char in a macro before the syntax package changes its meaning (at begin document) and then use the macro instead of the underscore:

\documentclass{article}
\usepackage{syntax}
\let\UnderScore_
\begin{document}
\input{bla\UnderScore bla}
\end{document}

A more general solution: revert the meaning of _ (maybe locally) using

\catcode`\_=11

This will make _ a normal character again. You can re-activate syntax's redefinition by doing

\catcode`\_=\active

You can put these two in two macros \makeunderscoreletter and \makeunderscoreactive and use it locally:

\documentclass{article}
\usepackage{syntax}

\newcommand{\makeunderscoreletter}{\catcode`\_=11}
\newcommand{\makeunderscoreactive}{\catcode`\_=\active}

\begin{document}
\makeunderscoreletter
\input{bla_bla} % interprets _ as letter
\makeunderscoreactive

my_variable % uses syntax redefinition

\end{document}