I'm afraid you can't. Looking at Gmail help, there's nothing related to searching within attachments.
You can specify a file name, but that's it:
filename:physicshomework.txt
Or you could save files you want to search through to Google Docs.
The simple explanation why it's not possible is that it would require a tremendous amount of indexing to be done. Gmail search isn't that fast to begin with, and I can imagine it'd take far too long to search within attachments.
Also note that this is a feature that even most desktop clients don't do.
That being said, there seems to be a startup that focuses on what you want: attachments.me
Attachments.me indexes your email account and presents an attachments-centric view of it. We create thumbnails, let you search within attachments, and, above all, make your email better