As soon as you see the phrase "difference between the squares" you should know exactly what to do. Use the difference of two squares formula:

a²-b²=(a-b)(a+b)

So we know (a+b)(a-b)=8. The only ways to factorise 8 are 1*8 and 2*4. You can't have a+b=8 and a-b=1 (since that would give 2b=9 and it's clear from context that were looking for whole numbers) so it must be a+b=4 and a-b=2. Therefore a=3 and b=1.