That's an excellent question. Here's the scoop:
1. You can focus on the target muscles more selectively. When doing squats, you hit a lot of muscles at once and expend a lot of energy. With the leg curl or extension, you can target only the hamstrings or the quads, giving all your energy to that muscle group. This can be especially important for the hamstrings, which are often neglected.
2. You can work that target muscle more intensely. Because you are focusing more tightly on one muscle group, you can increase the intensity for it.
3. Leg curls/extensions are easier. Since you are using less muscle mass, the exercises are easier to do. They won't affect your whole body the way squats will. Squats will use up a lot of energy.
4. These two exercises are far easier to learn and are less technique-intensive than squats. Any beginning trainer can do leg curls or extensions but not everybody can jump right in and do squats. Being easier, they are also useful for more advanced trainers in the later stages of a workout where you are already fatigued and squats may not be the safest exercise to do.
Disadvantages of the Leg Curl/Leg Extension
1. They are isolation exercises. Because they only work one muscle group, they won't have as much of an effect on real-world strength. There aren't any movement you do in real life that are done in isolation, like the curl or extension movement, however you do squat-like movements all the time.
2. Being isolation exercises, they don't address the functions of the muscles as an integrated system the way squats do. This can lead to imbalances if you do only these movements exclusively.
3. Leg extensions can be harmful to your knees. The position of your legs in the exercise place a lot of torque on the connective tissue in the knee joints. Heavy leg curls, especially if you use momentum, can really mess your knees up. Back off on the weight and focus on the squeeze instead.
4. They normally require very specialized machines. These machines aren't normally cheap. You can, however, improvise both of these exercises using dumbbells.
Advantages of Squats over Leg Curls/Leg Extensions
1. The squat is a very functional exercise. It will build your muscles and strength faster than nearly any other exercise. The squat movement is done in real-life all the time and is very useful to train with.
2. Squats affect a far greater amount of muscle mass. This can stimulate muscle growth over your entire body, not just your legs. The other two exercises can't claim this.
3. Squats require less specialized equipment. You can do them without any weight at all. You can do them holding a dumbbell. You can do them with just a barbell and some racks.
4. Squats work the body as an integrated system. Muscles are used in ways they were designed by nature to be used in.
Disadvantages of Squats
1. They require good technique to prevent injury and maximize results. A person learning squats should be supervised by a qualified instructor. It's not normally wise to jump right in and do them if you don't know how.
2. Form can be tricky to learn. A good squat is not easy to perform. It is very easy to use poor technique but still get the weight up and down. Proper technique is crucial.
3. Squats are hard. It is for this reason most people don't do them. Because they're hard, they're that much more effective than leg curls or leg extensions.
4. Squats can be uncomfortable. For some people, having the bar across their back can be painful. There are things you can do to minimize this pain, e.g. pads, towels, or a Manta Ray.
5. Squats require a lot of energy. Doing a few hard sets of squats first in your workout can really drain your energy levels for the rest of the workout. If you do them last, you may not have as much energy to do them either.
To sum it up, which exercises you should do really depends on your goals, experience level and motivation.
If you want to build muscle and strength, do squats. If you are trying to focus more specifically on these muscles, do the leg curls or extensions. To be honest, the best solution is to incorporate all the exercises into your routine (to me, however, leg extensions are optional).