As I said, it's all in the HTML::Tree perl package.
Oldish versions of the package (and it seems to be the case for the version included in the windows .exe distribution of mobiperl) in some cases convert into spaces when condensing whitespace. Newer versions seem to fix this problem, by only condensing real spaces tabulators and newlines.
As for the </p> tag, it's an option in the as_HTML procedure (
http://search.cpan.org/~sburke/HTML-...UMPING_METHODS). By default </p>, </li>, </dt> and </dd> are omitted, this can be avoided by calling as_HTML(undef,undef,{}) instead of just as_HTML(), and it happens both in html2mobi and mobi2html.