tl;dr: There are multiple reasons for Chiang to treat them different. They differed in their culpability, their readiness to make amends, and their connections.
Connections
Chang Hsueh-liang had an extremely valuable connection in the person of Soong May-ling, the wife of Chiang Kai-shek. The two had met in Shanghai in 1925, and kept up a life long relationship illustrated by their many correspondences over the years. During the incident, Madame Chiang flew to Xi'an to take part in the negotiations, guaranteeing Chang's safety in the process.
In an interview where Chang was exploring publishing a memoirs, the Young Marshal noted that:
西安事變後我沒死,關鍵是蔣夫人幫我。
The key reason I didn't die after the Sian Incident is that Madame Chiang helped me.
In contrast, Yang Hucheng's connections were mostly of the Communists variety. Obviously, this did him no favours with the ardent anti-Communist Chiang Kai-shek. The striking difference in their associations sufficiently explains the Generalissimo's attitudes without resorting to whimsically concocting "bandit" or "family" connections.
Culpability
First off, although the rebellion was carried out under Chang Hsueh-liang's name, the idea in fact originated with Yang Hu-cheng. Chang was adamant about keeping Chiang alive, ordering his soldiers not to shoot unless absolutely necessary (though they pretty much ignored this). Once Chiang had been captured, the Young Marshal professed his purity of intentions and promised no harm would come to the Generalissimo.
Chang was eager to negotiate for Chiang's safe release, unlike Yang Hu-cheng who wanted an execution (with support from many of their subordinates, not to mention the Communists).
Zhou Enlai ... arrived to find that Zhang Xueliang and Yang Hucheng disagreed about the future course of action concerning Chiang Kai-shek. Whereas Zhang was ready to negotiate Chiang's release, Yang was in favor of executing him.
- Barnouin, Barbara, and Changgen Yu. Zhou Enlai: A Political Life. Chinese University Press, 2006.
When finally the Nationalist leader compromised and verbally agreed to end the civil war, Chang was willing to take his word for it. Yang however sided with the Communists and insisted that Chiang should sign a written promise, and called for him to be held captive longer.
Given these turns of events, it is no surprise who Chiang bears a stronger grudge towards.
Making Amends
After the crisis was resolved, Chang willingly took the rather incredible step of accompanying Chiang back to Nanking. He threw himself at the mercy of the central government, knowing how treason is typically punished. Decades later he himself asserted that had their positions been swapped he wouldn't hesitate to order the execution of an insubordinate rebel.
軍人叛變是死罪,但我卻活了下來。40年失去自由是公平的
A soldier rebelling is a capital crime, but I was allowed to live. 40 years of house arrest is fair.
Whether he was sincere or not, Chang affirmed his support for Chiang as the leader of China. By his submission he sought to help repair the blow to Nationalist authority he himself delivered.
Yang was much less willing to ingratiate himself with the Generalissimo. Even though he technically received an even more lenient punishment ("sent" to Europe on a government tour for research), the deposed general continued to be highly critical of the Nationalist Government in general and Chiang personally in particular. Once the Japanese invasion began, he snuck back to China with some designs on acquiring a military command again, and was promptly seized.
His hawkish attitude during the crisis, and subsequent failure to behave, probably doomed him and his family. His death wasn't so much a punishment as it was an assassination, marked by a strong element of vengeance.