The program
grub-script-check
takes a GRUB script file and checks it for syntax errors. It may take a path as a non-option argument. If none is supplied, it will read from standard input. More information: https://www.gnu.org/software/grub/manual/grub/html_node/Invoking-grub_002dscript_002dcheck.html.
grub-script-check {{path/to/grub_config_file}}
grub-script-check --verbose
grub-script-check --version
grub-script-check --help