Just a quick tip, because nothing I found in a quick Googling was helpful. I was writing a plugin for Wordpress recently that functioned as a filter on the_content, like many, many plugins do. As I was applying the CSS/HTML from a design mockup that I had sliced up from a PSD, I noticed that some of the spacing was funny for no apparent reason. Thanks to Firebug, I quickly discerned that Wordpress was randomly* sprinkling <p> and <br/> tags all over the place, in ways that very much broke my layout. I could fix it by smashing all my tags up onto one line, which seemed to dissuade Wordpress from throwing tags in, but that was ugly and made my code rather unreadable.
After a bit of research, I found out that this was the doing of the potentially useful, but unintentionally nefarious wpautop filter. After some more digging, I realized that if I could get my filter to happen after wpautop had worked its "magic," all of my problems were solved. Fortunately, the add_filter function provides just such an option. And upon investigation, the previous author (I'm revising an existing plugin) had set it to be priority 0 (aka before everything). I switched that up to priority 99, and the random paragraphs and breaks disappeared, and my layout fixed itself.
*Okay, there was some rhyme and reason, such as after images, or before divs, or something...but the point is, it was putting them places where I didn't tell it to, and didn't want them. End of story.