Martyr is (as a noun)

> a person who is killed because of their religious or other beliefs.

or (as a verb)

> kill (someone) because of their beliefs.

There is not exactly something like that in our Shastras but to your question **is there anything close?** i have an answer.

In Sanatana Dharma or Hinduism both Brahmins and cows have eaxlted positions.They are both considered Holy and the holiest among their kinds.

Killing a Brahmin or a cow are both grave sins with the former being listed among the 5 gravest sins(5 Mahapatakas) in all Hindu scriptures.

For example,

> Manu Smriti 12.55. The slayer of a Brahmana enters the womb of a dog,
> a pig, an ass, a camel, a cow, a goat, a sheep, a deer, a bird, a
> Kandala, and a Pukkasa.
> 
> Manu Smriti 9.235. The slayer of a Brahmana, (A twice-born man) who
> drinks (the spirituous liquor called) Sura, he who steals (the gold of
> a Brahmana), and he who violates a Guru’s bed, must each and all be
> considered as men who committed mortal sins (mahapataka).

Now, the same Shastras say that if someone sacrifices one's life while saving a Brahmin or cow commits a great punya(an act of great merit).Similar is the case when that person does not die but saves the cow or the Brahmin.

> Manu Smriti 11.79. **He who unhesitatingly abandons life for the sake of
> Brahmanas or of cows**, is freed from (the guilt of) the murder of a
> Brahmana, and (so is he) who saves (the life of) a cow, or of a
> Brahmana.

[![enter image description here][1]][1]

The exact verse is found in the Parashara Smriti as well.

[![enter image description here][2]][2]

I don't know if i have answered your question or not but these are the closest examples i found from Hindu Shastras that talk about "sacrificing life for saving religion,or for the sake of religious beliefs"


  [1]: https://i.sstatic.net/vO89b.jpg
  [2]: https://i.sstatic.net/rFTWZ.jpg