Diplomatic immunity is a special law that covers people who work in embassies or consulates. The people are called a diplomats. The diplomatic immunity means that although they live and work as a visitor inside a "host country", they are not ruled by the law of that country. They are only ruled by the law of their home country.
A diplomat can work without interference from the police and government of the country where he works. Diplomatic immunity means that a diplomat can keep the secrets of his own country's government, without the government of the host country being able to find out about them.
Police from the host country cannot arrest a diplomat, or search a diplomat's house or office. They cannot even give a diplomat's car a parking ticket without the permission of the diplomat's government.
Honorary consuls only work part-time as diplomats, so only have diplomatic immunity when working as diplomats. Police may search their offices, but not the part where they keep their diplomatic work.