The previous answers give awesome explanations to differences in usage of these two phrases. Ad you can see, they are quite similar. One difference worth noting is that 而已 comes from classical Chinese, so it's more literary or formal, while 罢了 is more colloquial.