It is important to look at this passage as a whole and to consider what is going on in it.
Zechariah 12:10-14 “And I will pour out on the house of David and the inhabitants of Jerusalem a spirit of grace and pleas for mercy, so that, when they look on me, on him whom they have pierced, they shall mourn for him, as one mourns for an only child, and weep bitterly over him, as one weeps over a firstborn. 11 On that day the mourning in Jerusalem will be as great as the mourning for Hadad-rimmon in the plain of Megiddo. 12 The land shall mourn, each family[a] by itself: the family of the house of David by itself, and their wives by themselves; the family of the house of Nathan by itself, and their wives by themselves; 13 the family of the house of Levi by itself, and their wives by themselves; the family of the Shimeites by itself, and their wives by themselves; 14 and all the families that are left, each by itself, and their wives by themselves. (ESV, emphasis added)
Who is mourning?
So we must ask, who is this directed toward? The simple answer is that it was the Jews who were responsible for Christ's crucifixion.
How is that connected to the houses that are named, those were we are told will mourn? Judah is not named directly. However, we are given the house of David, the house of Nathan, the house of Levi, and the family of Shimei. They all seem to be contemporaries of David, so the most natural identification is King David, the Prophet Nathan or David's son Nathan and Shimei.
David
David is of the house of Judah. His house rules both the tribe of Judah(2 Samuel 2:4) and all of Israel (2 Samuel 5:3-5).
In 1 Samuel 17:12 we see that David is the son of Jesse from Bethlehem in Judah. It was promised to Judah that it would rule the nation in Genesis 49:10, and it was fulfilled in David and his descendents (Psalm 132:11). We are also told the Messiah will come from the house of David in Isaiah 11 and Micah 5.
Nathan
The most prominent Nathans are both from the time of David, Nathan the Prophet and Nathan son of David.
The Prophet Nathan's house is not known for certain.
David's son Nathan (1 Samuel 5:14). It is likely that the Nathan listed as the father to two of Solomon's advisers and officials (1 Kings 4:5) was Solomon's brother. Luke lists Joseph, Mary's husband, to be the descendent of Nathan, son of David, while Mary is recorded in Matthew as descended from Solomon.
Here is a brief summary of the Nathans in Scripture.
Shimei
The first Shimei we find in the Bible is of the house of Levi, Levi's grandson to be exact (Numbers 3:17-18). However, he is not contemporary with David. Rather the Shimei of 2 Samuel 16 and 19 who curses David but later repents to him would make more natural sense.
This Shimei is of the tribe of Benjamin. 2 Samuel 16:5, 1 Kings 2:8.
He is told by Solomon to settle in Jerusalem and not to leave or he will forfeit his life. He later leaves to catch slaves and when Solomon hears of it he orders Shimei's death. It was with this act that we are told Solomon finally secured the throne. What became of the rest of Shimei's family we do not know.
The other major Shimei is the son of Ela, one of Solomon's the twelve advisors [1 Kings 4:18]. Shimei son of Ela is said to be "in Benjamin" so two of our three major options are of Benjamin and the third is a Levite. Levi is mentioned separately next though, so it seems unnecessary to list Shimei the Levite when he is included within two generations of Levi himself.
I would judge the Shimei here to be the son of Gera or son of Ela, either way representative of the House of Benjamin.
House of Levi
Levi is quite unique as there is really only the original Levi, son of Jacob. So the house of Levi would seem indicative of the tribe of Levi.
Families that are left
We are initially told the land of Jerusalem will mourn, each family by itself, and then it goes into details of which families that includes. But when we are told "all the families that are left [in the land]" it implies there are additional families included that will mourn. The ones listed are of special note then.
So who are they in regard to the prophecy?
So we have named here families from the tribes of Judah, Levi and Benjamin.
If this isn't immediately familiar, those are in fact the tribes of the Southern Kingdom who are taken into exile and later return.
Judah and Benjamin were the primary tribes of the Southern Kingdom. Judah's land was to the south (Joshua 18:5) and Benjamin's land was around and included Jerusalem (Joshua 18:11-20,the Jebusite City is Jerusalem).
The Levites were a bit different than the other tribes, having allotments in all regions, and of course the Priests lived in Jerusalem where the Temple was built. Numbers 35 and Joshua 14:4. So there were Levites in the Southern Kingdom as well.
Levites of the the Zadok line, Judahites from Solomon and Nathan (son of David), and Benjamites and other families of the surrounding area were all taken into captivity by the Babylonians. While the Northern Kingdom was taken and dispersed, never to be returned, the Southern Kingdom later returned to Judea.
The origin of meaning of the term "Jew" is "Judean" they are the people of "Jewdah." Here is an in depth study of the origins of "Jew".
What is the significance of who is mourning?
I would submit that "When they look on me, on him whom they have pierced" is the suffering servant of Isaiah 53 "he was pierced for our transgressions". It is only the Messiah who God can call "me" and "him" in the same sentence. Those who rejected and pierced him will be shamed. We are then told who the mourners are, they are the families of the Jews.
It is the Jews who have pierced him, Jesus Christ.
What is significant about this prophecy?
When was the prophecy made?
First let's take a quick look at when this prophecy was made. There is actually quite a bit of debate about chapters 1-8 and 9-14 being different in language and possibly authorship and dating. However, more recent estimations would be around 500 BC, even if it was not written by Zechariah. (Baldwin)
This puts it just around the time of the early returns to Judea from captivity and the rebuilding of the temple by Zerubbabel, who is mentioned many times in the 4th chapter of Zechariah.
Has the prophecy be fulfilled? If not, when?
There are many elements of chapters 9-14 that seem to be fulfilled intermixed with passages that do no seem to be fulfilled.
Chapters 9 and 10 speak of a messiah, a king, a cornerstone, but then also speak of a gathering and a return to the land of their forefathers by both Judah and Ephraim. At the most the messianic prophecies and the return of Judah in the Jews in the current nation of Israel are fulfilled, but Ephraim is still absent. We are told Judah will receive salvation first in Zechariah 12:7 so a partial fulfillment seems acceptable.
Much of Zechariah 12:1-9 would seem to be unfulfilled. Yes, while the Jews have been restore in the nation of Israel and they have been protected though many nations came against it, it has not been to the extent that we read in 12:9 where all nations that come against Jerusalem have been destroyed.
So our section in Chapter 12:10-14 is possibly being fulfilled or is soon to be.
It will be fully fulfilled when we see large conversion of Jews to Christ.
Those that mourn will have poured out on them a spirit of grace and pleas for mercy toward God, Him whom they have pierced.
Baldwin, Joyce G. Haggai, Zechariah, Malachi. An introduction and commentary. Inter-Varsity Press, 1972