Here are the details from this Todd Archer link:
The Cowboys gave Melton, who is coming back from a torn anterior cruciate ligament, a $1 million signing bonus as part of the deal he agreed to Tuesday night with a $1.25 million base salary. He can earn an extra $78,125 per week if he is on the 46-man roster, maxing out at $1.25 million. His first-year cap number at present is $1.734 million but will grow through the season each week he is on the gameday roster.
The kicker in the deal comes in 2015 when he would earn a fully guaranteed $9 million base salary. The base salaries in 2016-17 are $7.5 million each.
There are also $1.5 million in incentives in the deal for playing time and sacks in 2014.
Here are the best case, worst best case, worst case and likely scenarios. Costs are salary cap costs.
Melton has an All-Pro year like 2012, and the Cowboys exercise their option fully guaranteeing him his 2015 salary. He goes on to beast for the next 3 years while the Cowboys pay him a decent amount for above average production. This costs, $2.984M in 2014, $10.516M in 2015 (assuming incentives all reached, they carry over to the next year), and $7.75M in 2016, $7.75M in 2017.
Worst best case
Melton has an All-Pro year like 2012, and the Cowboys exercise their option fully guaranteeing him his 2015 salary. He promptly pulls a Spencer in 2015, and the Cowboys release him after the 2015 season. This costs, $2.984M in 2014, $10.516M in 2015 (see above), and $0.50M in 2016 (dead money).
Melton never full recovers from the ACL tear and gets cut in the 2014 pre-season. This costs, $1.734M in 2014, and $0.75M in 2015 (dead money).
Likely scenario 1
Melton plays ok, but is JAG to average. This costs, $2.984M in 2014, and $0.75M-$2.266M in 2015 (dead money and incentives from previous year).
Likely scenario 2
Melton plays at a near All-Star level in 2014. Then declines as the years pass by. This costs, $2.984M in 2014, $10.516M in 2015 (see best case scenario), and $7.75M in 2016, and $0.25M in 2017 (likely cut and dead money).
This seems like a really good deal for the Cowboys, in that if he's an All-Pro, they get him for ~$3M in cap space for 2014, and even if he is a complete dud, they're only on the hook for $1.734M in 2014 and $0.75M in 2015. And even if the worst best case scenario happens, while the $10.516M cap hit in 2015 for a 2013 Spencer season is a lot, the Cowboys can actually absorb that fairly decently, since they're no longer way above the cap for 2015.