The easy way is to do something like this in your document
.. role:: envvar
This is an envvar: :envvar:`PATH`
Which will produce something like <span class="ennvar">PATH</span>
The problem with that is that (I think) that will break when you put the same document in Sphinx because it already has a envvar role, and this collides with it.
Harder is: write the custom role in an extension. BUT there is already a sphinx_roles plugin that has all you need to do it.
OTOH I just did it ;-)
You can wait a day and reinstall that plugin, or just do this tiny change in your sphinx_roles.py and it should "Just Work":