To fully understand this injury you have to have a basic understanding of the anatomy of the hips.
The Glutes (or gluteus maximus to be more specific) attach on the pelvis and the femur, making it a one joint muscle and our primary hip extensor
The hamstrings run from attachment sites on the pelvis to down below the knee, making them two joint muscles. That's why hamstrings can be trained through either hip extension exercises like Romanian Deadlifts, or knee flexion exercises like leg curls.
These muscles (the hamstrings and gluteus) are intended to work in unison with each one contributing force during certain parts of a movement depending on joint angle. This applies to squatting, deadlifting, lunging and even simple walking and running patterns. When the hamstrings are overly active it can pull the femur forward in the hip socket, causing an irritation in the front of the hips. This is due to the attachment site on the tibia. The distance between origin and insertion causes a gross movement pattern, lacking in stability near the joint. This over activity can also be the cause of hamstring and groin strains and many cases of lower back pain as well.
When the glutes are appropriately strong they maintain stability at the hips and keep the femur secure within the socket where it should be. The glutes are able to do this more effectively than the hamstring because of their shorter length and attachment near the head of the femur.
Imagine trying to pick up a big pipe shaped like the letter L. Picking it up by the bottom of the letter is like just using your hamstrings. It's likely to tip over while you carry it (or in the case of the femur, bang up against the anterior capsule). Picking it up by the top is like using the glutes, because of the attachment site near the head of the femur. It is a much more stable position but when moving something heavy it's still not optimal. You want to grab that pipe with two hands to be as strong and as stable as possible. That's the effect of getting a go co-contraction of the hamstring and glute muscles.
At this point you probably just want to know how to make the pain go away so you can get back to your normal routine. The key is figuring out what caused it in the first place and then eliminating the bad things and adding in a few things to correct any imbalances  Here are some ideas:
1. Stop cranking on your hip flexors. I know the pain feels like it's a tight hip flexor but it probably is not. Repeatedly leaning hard into that tender area is going to put greater amounts of pressure on the already inflamed zone.
Don't do this
3. Finish all of your hip extension lifts with a strong glute contraction. Not only will that prevent anterior hip pain but it also will strengthen the glutes to a greater degree, allowing for better overall performance.
This would be a perfect example of deadlift technique that would promote injury to the anterior structures of the hip. Notice the hard arch at the top and lack of glute involvement.
How to not complete your squat. Poor lockout leads to anterior glide of the femoral head. 
Whether you are squatting, deadlifting or even lunging it's very important that you complete the ROM with each repetition. Complete hip extension will help prevent the hamstrings from dominating the glutes while also protecting the lower back and improving strength in general
3. Strengthen your glutes. This is a cure (or at least part of the cure) for atleast 75% of the problems that I see in my gym. Stronger glutes have a myriad of benefits but specific to this issue they will maintain stability of the femoral head in the acetabulum, preventing the anterior shift and associated pain. Start with simple ground based exercises like bridges and progress into single leg work and then eventually back to basic barbell training.
Strengthening the psoas and stretching the TFL would also be on my correction to do list but after correcting these more obvious problems. Hopefully this helps at least one person fix a nagging injury and get back to their normal training routine.
 Actually still in the process of reading it. That thing is a monster.
 in some cases no corrective exercise needs to be added at all and it is a simple case of addition by subtraction
 The videos above are of Lee Boyce and Eric Cressey. Both are great trainers and are doing the lifts incorrectly as a teaching tool