If Tony Romo retires or gets released next year, the Dallas Cowboys wouldn't owe the QB any money.
As
@bkight13 said, the 2017-19 base salaries in Romo's contract are not guaranteed.
That's $54M in cash savings over those three seasons.
While Romo's base salaries would not count against the salary cap, the remaining pro-rated signing bonus would.
This is money that was paid in the past but counts in small, equal portions over a 5 year period so long as the player remains under contract (a $10M signing bonus will count $2M per season for 5 years).
If the contract is terminated early, be it retirement, release or trade, the remaining signing bonus money will all come due. Depending on the timing of the move, all of the bonus money (often referred to as dead money) may hit in one season or it may be spread over two.
2017: $14,000,000 base salary, $10,700,000 yearly signing bonus proration, $24,700,000 salary cap number, $19,600,000 potential dead money (entire remaining signing bonus proration), $5,100,000 potential salary cap savings (the difference between the dead money and Romo's cap number)
2018: $19,500,000 base salary, $5,700,000 yearly signing bonus proration, $25,200,000 salary cap number, $8,900,000 potential dead money, $16,300,000 potential salary cap savings
2019: $20,500,000 base salary, $3,200,000 yearly signing bonus proration, $23,700,000 salary cap number, $3,200,000 potential dead money, $20,500,000 potential cap savings