I would recommend doing a little reading on the OSI model. It might help shed a little light on this, but I will give you a brief overview so this makes more sense. Remember that these concepts can blend together and a firewall could have all of these features.
A traditional network firewall operates at layer 3 and layer 4 of the OSI model, which is IP addressing/ICMP and TCP/UDP. In its simplest sense, it's a hierarchical rule chain that blocks or allows specific packets which match a specific criteria. This type of firewall implementation has little to no awareness of "higher" layers of the OSI model.
An application proxy is typically said to exist at layer 7 of the OSI model, the application layer. These proxies must understand the protocols that they proxy, such as HTTP. A firewall can often have these features as well. A web proxy, with its awareness of web protocols, can have content filtering features which could filter ads. A device or software package described as a firewall could have these features. These are typically called application firewalls or layer 7 firewalls.