bemhtml: move most used vars to the scope

Backport (or forward-port?) of:

https://github.com/bem/bem-bl/commit/b7c74fdd1d9c87f4c84f22425ef926b7989c5b0d