It looks like markdown and potentially other grammars support enabling extensions or extra features during compilation through the use of environment variables. It would be really nice to have a built in way to provide extra environment arguments.
I am not sure how this would work with the current API that assigns a single grammar to a major mode. I could see it working as a selector between multiple supported grammars or just a way for the user to pass env vars to an existing grammar. I am happy to try to get either option to work, but wanted to discuss the direction and see if there was interest in supporting this feature.