I've just struggled with the exact problem, and I ended up modifying miniBB because I didn't agree with how those variables was used. And also because I want to integrate miniBB in existing sites.
Here's how I think they should be used, and how I rewrote miniBB:
$main_url - Main URL with trailing "/". Points to the sites main URL, ie "http://www.site.com/" where the sites main index.php is at. OR if I choose to use miniBB's index.php in a subdirecory: "http://www.site.com/forum/".
$pathToFiles - Relative path to files, "forum/". Points to where the files are, the root of the minBB-system. For the miniBB to be able to find its graphics and other files. The problem with the original miniBB are that graphics are pointed to by only the $main_url + "/img....". In my version its made up by $main_url + $pathToFiles + "img..." So if i use the full path in $main_url I leave this one blank.
I had to rewrite all links in minBB to, they are (usually, not all) made up with $pathToFiles + $indexphp. I had to make sure that all links are generated by: $main_url + $indexphp. I found that the code for miniBB had some inconsistencies in generating links, which got to the surface when wantnig to place miniBB in a subfolder and still having your own parcercode in the root.
By making these modifications I got a versatile miniBB, to place anywhere I choose. It took a couple of hours rewriting, but its worth the effort, miniBB is an excellent piece of work!!
If you choose to use your own index.php in the root you have to handle setcookie, or else you got problems logging in/out. Cookies must be sent before all other code, since they are sent with the headers. I recommend you use miniBB index.php, and use the $includeHeader/$includeFooter settings to point to your own code.