1. He will be back in a few days.

2. He will be back after a few days.
3. He will be back within a few days.
-----------------------
Are they all grammatical?
What is the difference between #1 and #2?

All are correct. There is really no difference between #1 and #2, although #2 seems more indefinite. It really isn't, but SEEMS so.