Just use the most powerful pattern matching tool you have at your disposal: your eyes. I ran into the same problem some time ago (was compiling a big list of Django apps and jQuery plugins, and most of them didn't explicitly name the license they were using), in the beginning I had to compare to a reference text all the time, but it didn't take long for me to become able to identify those licenses in a glimpse. Here's what I see when I look at the MIT license:
Copyright (C) <year> <copyright holders>
Permission is hereby granted, text text text
text text text
text text text
The above copyright notice and this permission notice text text text
TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT
And the Modified BSD:
Copyright (c) <year>, <copyright holder>
All rights reserved.
Redistribution text text text
* text text text
* text text text
* Neither the name of the <organization> nor the
text text text
TEXT TEXT TEXT
TEXT TEXT TEXT
Notice how the text layout combined with a few key words/phrases are enough to identify those two licenses, and since they are by far the most common (that don't display its own name in the header, like the GPL or the Apache) they're easy to memorize (and obviously, I can tell it's BSD-3 because it has 3 bullet points).
Now, it's always possible - though very unlikely - that the authors used a slightly different license that you could mistake for the MIT/BSD-3, but if they did and they care about the difference, you can reasonably expect them to call attention to it.
Update: check this answer to a SO question about "grepping" a page using JavaScript; maybe with a little work one could write a small tool (a bookmarklet for instance) to search the contents of a page for the text of a license among a small set of known ones (written as a regex, since you'd have to replace the <copyright holder>
and such for wildcards). I avoid bookmarkets because of the security implications, but if you either wrote or is hosting (if applicable) them yourself you should be fine. I know no existing tool for that purpose though.
Personally, I don't think it's worth the trouble - the effort to carefully examine a license is only a small part of the decision to incorporate it into a big project. Usually the troublesome parts are the library dependencies, or the relative effort to integrate them with the rest of your code. So I prefer to do a quick classification into "might use" or "definitly won't use" and then, if I decide the library is really promising, take a closer look at the license.