“his heart trembled.” This is referring to the king of Judah, Ahaz. There is good reason Ahaz’s heart—and also the hearts of the people of Israel—trembled when he heard that Syria was allied with “Ephraim” (Israel). At this point in history, Israel and Syria were both larger nations than Ahaz’s country of Judah, and the fact that they had allied themselves against him ostensibly mean his doom and the end of Judah. In fact, Syria and Israel were so confident of victory in a war that they had already picked a person to be the new king of Judah, the son of Tabeel (or “Ben-Tabeel”).
“Ephraim” was the most prominent and powerful tribe in the nation of “Israel,” and so in this context “Ephraim” stands for the whole country of Israel. Technically, this is the figure of speech synecdoche of the part, when a part is put for the whole. Ephraim was often put for the country of Israel although at other times Ephraim had more of the connotation of Samaria, the capital of Israel because that was where the king lived and thus it was the center of corruption and idolatry (cp. Isa. 7:2, 5, 8; 11:13; 17:3; Jer. 7:15; 31:9; Hos. 6:4; Zech. 9:10). Also, although technically the city of Samaria was in the tribal area of Manasseh, the fact that Ephraim and Manasseh were both “the tribe of Joseph” (Deut. 33:13; Josh. 17:14-18; 18:5; Judg. 1:22), the fact that the exact boundaries between the tribes were often ignored, and the prominence of Ephraim such that often all Israel was called “Ephraim,” led to the city of Samaria being referred to as being part of Ephraim (cp. Isa. 7:9).