The filter is passed to cfgmaker on the command line.  So, you can enter it when you type in the command.  If you are calling cfgmaker from some external script, then you may need to modify this somehow, but that will depend on how you have set up your system.
The format of the filter itself is Perl code.  In order to create a filter, you'll need to understand the basics of Perl coding, and the names of the variables that are pre-set for your use.  These are detailed in the cfgmaker documentation:  
http://oss.oetiker.ch/mrtg/doc/cfgmaker.en.html