I think <a> tags are supposed to be enclosed in a block tag, e.g. <p> or <div>. Correcting them will probably make Beautify work properly. I've often seen "detached" <span> tags similarly misused in epubs.
In your particular example those Google Books epub <a> tags are usually worthless (IMO) so just removing them will also make the Beautify problem go away.