Layer 2 switching (also known as bridging) is a hardware-based bridge. Packets are forwarded based on the unique MAC address of each end site. The high performance of Layer 2 switching can result in network designs that increase the number of hosts per subnet. It still has the characteristics and limitations of bridging.
Layer 3 switching is hardware-based routing. The main difference between a router and a Layer 3 switch in packet switching operations is the physical implementation.
Layer 4 switching is simply defined as the ability to make forwarding decisions based not only on MAC (Layer 2 bridging) or source/destination IP addresses (Layer 3 routing) but also on TCP/UDP application ports. It enables the network to differentiate between applications when deciding on routing. The ability to prioritize data flows based on specific applications. It provides a more granular solution to the policy-based quality of service techniques. Provides a way to differentiate between application types. (Link)