When Hanuman was sent to Lanka as a peace messenger to King Ravana, he was humiliated and his tail was set on fire. In turn, Hanuman burnt the entire city of Lanka to ashes. Was it right to punish the denizens of Lanka for Ravana's act? What does the action of Hanuman signify?
The answer of your question is provided in Valmiki Ramayana
तथा चेन्द्रजितो वेश्म ददाह हरियूथपः | जम्बुमालेः सुमालेश्च ददाह भवनम् ततः || ५-५४-११ रश्मिकेतोश्च भवनम् सूर्यशत्रोस्तथैव च | ह्रस्वकर्णस्य दंष्ट्रस्य रोमशस्य च रक्षसः || ५-५४-१२ युद्धोन्मत्तस्य मत्तस्य ध्वजग्रीवस्य रक्षसः | विद्युज्जिह्वस्य घोरस्य तथा हस्तिमुखस्य च || ५-५४-१३ कराळस्य पिशाचस्य शोणिताक्षस्य चैव हि | कुम्भकर्णस्य भवनम् मकराक्षस्य चैव हि || ५-५४-१४ यज्ञशत्रोश्च भवनम् ब्रह्मशत्रोस्तथैव च| नरान्तकस्य कुम्भस्य निकुम्भस्य दुरात्मनः || ५-५४-१५ वर्जयित्वा महातेजा विभीषणगृहम् प्रति | क्रममाणः क्रमेणैव ददाह हरिपुङ्गवः || ५-५४-१६
11; 12; 13; 14;15; 16. varjayitvaa = leaving; vibhiiSaNa gR^ihamprati = the house of Vibhishana; haripuN^gava = Hanuma; mahaatejaaH = of great splendour; kramamaaNaH= went; krameNaiva = successively; bhavanam = to the house; rashmiketoshcha = of Rashmiketu; tathaiva cha = and;suuryashatroH = of surya shatru; hrasvakarNashcha = of Hrasvakarna; damSTrasya = of Damstra; rakSasaH romashasya = of Romasha the demon; yuddhonmattasya = of Yuddhaumatta; mattasya = of Matta; rakSasaH dhvajagriivasya = of Dhvajagriva; the demon; ghorasya vidyujjihvasya = of the terrific Vidyujjihva; tathaa = and;hastimukhasya cha = of Hastimukha; karaahasya = of Karala;pishaachasya = of Pishacha; shoNitaakSasya chaiva hi = of Shonitaaksha; bhavanam = the house; kumbhakarNasya = of Kumbhakarna; makaraakSasya chaivahi = of Makaraaksha;yajJNashatroshcha bhavanam = the house of Yajnashatru;tathaiva cha = and; brahmashatro = of Bhrahmashatru;naraantakasya = of Narantaka; kumbhasya = of Kumbha;duraatmanaH nikumbhasya = and the house of the evil minded Nikumbha.
Leaving the house of Vibhishana, Hanuman of great splendour, went successively to the houses of Rashmiketu, Surya shatru, Hrasvakarna, Damshtra, Romasha the demon, Yuddhonmatta, Matta, Dhvajagreeva the demon, the terrific Vidyujjihva, Hastimukha, Karala, Pishacha, Shonitaaksha, Kumbhakarna, Makaraksha, Yajnashatru, Brahmashatru, Narantaka, Kumbha as also the evil-minded Nikumbha and burnt the houses.
न अग्निः तृप्यति काष्ठानाम् तृणानाम् च यथा तथा | हनूमान् राक्षस इन्द्राणाम् वधे किंचिन् न तृप्यति || ५-५४-२८ न हनूमद्विशस्तानाम् राक्षसानाम् वसुन्धरा |
- yathaa = how; agniH = the fire; natR^ipyati = is not satisfied; kaaSThaanaam = with firewood; tR^iNaanaam = and dry blades of grass; tathaa = so also; hanumaan = Hanuma; natR^ipyati = was not satisfied; kimchit = even a little; vadhe = in killing; raakSasendraaNaam = of demons;vasundharaa = the earth; na = is not wearied;raakSasaanaam = with the demons; hanumadvishastaanaam= killed by Hanuman (receiving in her lap)
As the fire does not get satisfied with any amount of firewood and straw fed to it, Hanuma was not wearied in killing any number of demons. The earth was not then wearied in receiving the number of demons killed by Hanuma (in her lap).
These shlokas tell us the names of demons, whose houses were burnt by Lord Hanumana, during burning of Lanka. They also tell us that those people were demons and were evil. But there is no such mentioning of Lord Hanumana burning the houses of general people who were not evil or demons as such.
And clearly there is no report of any casualties. So he didn't affected, harmed or killed general innocent population during this act.
Or Lanka, as we call it, might be a fort of Ravana, with houses of his ministers and chiefs etc who were helping Ravana. Also the second shloka tells us that "earth was not tired of killing of demons by Lord Hanumana" so even killing of those demons is justified by Lord Hanumana.
You can see the purpose of Lord Hanumana's burning of Lanka here .
When Hanuman was sent to Lanka as a peace messenger to King Ravana...
First off, Hanuman was not sent as a messenger to Lanka. Instructions given to him were very clear. He was supposed to locate Sita and report back to Sugriva and Rama.
he was humiliated ...
Probably. But what prompted Hanuman to pick up a fight with Ravana's army? After Sita refused to sit on his back (so he could carry her away), maybe he should have silently and inconspicuously left Lanka? If he was really noble in his thinking and intended to have a word with Ravana to avoid the war, maybe he should have had the dialogue first and not start a war by uprooting the trees in Lanka?
and his tail was set on fire
Is this act by Ravana justified? Most certainly. According to Ravana, Hanuman was a spy not an emissary. What else should a king do with a spy? Thanks to Vibhishana's intervention, Hanuman's life is spared (it is different matter that he's a chiranjīvi).
Was it right to punish the denizens of Lanka for Ravana's act?
Absolutely not. Hanuman himself says the reason for starting a war with the Lanka generals and army was to assess the strength of Ravana's army. If he already engaged in a mini-fight with them before being captured, then what was the need to burn down Lanka?
What does the action of Hanuman signify?
There is a popular adage in Telugu which goes like చూసి రమ్మంటే కాల్చి వచ్చినట్టు (chuusi rammante kaalchi vachchinattu - when sent to merely find something, one comes back burning the whole thing down). So Hanuman's action is an apt reminder to people who are sent on specific missions how not to deviate from their assigned tasks.
Compare to Krishna's actions from Mahabharata when he was sent as a peace emissary to Hastinapura by the Pandavas - he doesn't show his power and what he's capable of until he was provoked and the situation demanded.
I do consider Hanuman's role in Valmiki Ramayana an important one, however, the incident of burning down Lanka is unfortunately not the best of his acts as Hanuman himself says:
Due to culpability of my anger, I have indeed shown this apishness that is famous for instability in the three worlds. [VR. 5-55-15]