If you have multiple firefox bookmark.html files, this code can merge them together while preserving their bookmark directory structures and removing the duplicates within each folder. i.e. duplicates not in the same folder will be preserved.
Windows users may want to download the executable bookmark_merger-0.2.2.exe which is completely self-contained. Using bookmark_merger-0.2.2.exe -h will give instructions on usage.
Otherwise, the python code can be downloaded. You will need python (~2.6) and the library pyparsing (~1.55). The archive can be extracted and used anywhere. Alternatively python setup.py install will move the code and script to the usual places in your python distribution.
There is also a windows installer which will directly install the code into your python distribution.
More instructions are contained in the archive.