One approach to interpreting these lines is to read them semi-literally: the tiger is such a fearsome creature that even the stars themselves threw down their weapons rather than face it, and wept at its power.
Stanzas 2–4 use the conceit of describing the tiger's making as the construction of a machine of war: something mechanical, unfeeling, cruel by creation. Even the famous phrase “fearful symmetry” of the first stanza alludes to this: machines and technology are symmetrical, and their construction is plotted and planned, “framed”, in the case of the tiger by some “immortal hand or eye” which is equal to the task of constructing such a weapon.
Stanza 2:
In what distant deeps or skies.
Burnt the fire of thine eyes?
On what wings dare he aspire?
What the hand, dare seize the fire?
This stanza places the origin of the fire burning in the tiger's eyes in some far-off place, either deep in the depths or far off in the sky, and questions what being would have the strength and the gall to claim it for the tiger's construction. To me this rings of the Promethean myth: like Prometheus, the tiger's creator dared to steal a powerful flame from somewhere beyond human ken and bring it back to Earth.
Stanzas 3 and 4:
And what shoulder, & what art,
Could twist the sinews of thy heart?
And when thy heart began to beat,
What dread hand? & what dread feet?
What the hammer? what the chain,
In what furnace was thy brain?
What the anvil? what dread grasp,
Dare its deadly terrors clasp!
The phrase “twist the sinews of thy heart” in stanza 3 alludes to rope-making, like the ropes used in siege machines or to restrain the cannons of Blake's time when on-board a ship. Stanza 4 describes a forge (the furnace where the tiger's brain was crafted) and other blacksmith's tools (hammers, chains, anvils).
Next come the two lines in question: “When the stars threw down their spears / And water'd heaven with their tears”. The previous stanzas implied a process of technological advancement, starting with the Promethean theft of the fire, advancing to rope-making, and then using the flame for metallurgy. The Tiger, a machine of war so fierce that not even the stars themselves could stand against it, is the culmination. But in something of a twist ending, Blake reveals in the next two lines that the Tiger is not a human creation: “Did he smile his work to see?
Did he who made the Lamb make thee?” The immortal hand or eye that dared frame the fearsome Tiger is the same benevolent creator who made the innocent lamb from “The Lamb”.
This leaves one question: why, specifically, the stars? Because it helps set up the “twist ending”. The first four stanzas, describing the tiger's creation, allude to a human creator with the reference to Prometheus and the mentions of physical body parts, such as shoulders, hands, and feet, and human tools such as hammers, chains, and anvils. The stars are clearly beyond all human power, but lines 17 and 18 imply that a human might have created something capable of overcoming them until the “twist” in lines 19 and 20. (I'm putting “twist” in quotes because it's not terribly surprising to anyone who's read “The Lamb” and recognized the parallel structure of the two Songs books, though line 20 does contain the explicit callback to “The Lamb”.)
This study help page says the two lines about the stars “may refer to the casting down of the angels after Satan rebelled against God”, which would make “stars” a metaphorical term for angels. This interpretation, when taken with lines 19 and 20, also helps set up the “twist”. Now we can interpret line 19, “Did he smile his work to see?”, as asking whether God, upon defeating the rogue angels, making them throw down their spears and weep as they were cast out of Heaven, smiled and took pleasure in his victory at war. In this light, line 20, “Did he who made the Lamb make thee?”, becomes an allusion to the dual nature of God, who, to the poet's disbelief, is both the loving, gentle being who made the innocent Lamb, and the vengeful, warlike being who made the vicious Tiger and smiled to see his defeated enemies weep.