With MeGUI it's complicated because it's not build to be variable framerate aware. Easiest is to either force constant framerate in the AviSynth source filter or to copy timecodes from source to target file using mkvtoolnix (like tebasuna51 said).
About HandBrake: you can add extra x264 options in the "Extra Options" field in the ffmpeg style. E.g.:
https://trac.ffmpeg.org/wiki/Encode/...presetsettings