Don't know anything about Mercurial/TortoiseHg, but found the
TortoiseHg FAQ. And according to the explanation on this page following may work
Add these lines to your personal Mercurial.ini file
[extdiff]
cmd.UltraCompare = C:\Program Files\IDM Computer Solutions\UltraCompare\uc.com
opts.UltraCompare = -d
Now run the Global Settings tool. On the TortoiseHg tab, you should see UltraCompare available in the drop-down list for Visual Diff Command. Select UltraCompare, apply, then close.
I'm not sure about the command line parameter. Is a directory or a file comparison started by Mercurial/TortoiseHg, or both?
If above does not work because Mercurial/TortoiseHg calls the comparison tool with files as well as with directories, don't use opts.UltraCompare (or let it blank) and specify instead of uc.com a batch file which finds out if the parameters are files or directories and then calls uc.com accordingly.
Note: uc.com can call uc.exe only when directory of uc.exe is specified in environment variable PATH. Something I don't like and therefore I have already sent an enhancement request because I think, uc.com can find uc.exe itself by first using its own path (uc.exe is normally in the same directory as uc.com) and if not found, try itself to find uc.exe using the directories specified in environment variable PATH. Last uc.com could look also into the registry for HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe to get the path of uc.exe. I write this here with the hope that other UC Prof. users also request from IDM an uc.com finding uc.exe without the need to add the UltraCompare directory to environment variable PATH. A workaround for using uc.com without UC program directory in PATH is to use a batch file which contains at top:
set PATH=C:\Program Files\IDM Computer Solutions\UltraCompare;%PATH%
or calls instead of uc.com directly uc.exe with the command:
start "UltraCompare" /wait "C:\Program Files\IDM Computer Solutions\UltraCompare\uc.exe" ...