Regarding groff - where is the config file and will this work?
For the first part of your question, "What file should the command go in?": put the command in ~/.bash_profile using your favorite editor. For example, you can do this using nano by opening Terminal and typing

nano .bash_profile


Type in the command and then press ctrl+X to exit. Say yes, you want to save the file.

For the second part, "Is there anything else I should know?": You are also going to need to install bcat, a program which allows you to send text to a browser via the command line. You can do this by running

sudo gem install bcat


in the terminal and entering your password.

Now you can view man pages in your browser by typing bman. For example:

bman ls