In Bhagavad Gita it's mentioned that Yajna, Tapa and Dana are the Karmas which a person should never abandon in his life.
What is 'Tapa' in Hinduism?
Yes, the Bhagavad Gita says it in the following verse:
tyājyaṁ doṣa-vad ity eke karma prāhur manīṣiṇaḥ
yajña-dāna-tapaḥ-karma na tyājyam iti cāpare [BG - 18.3]
Some learned men declare that all kinds of fruitive activities should be given up as faulty, yet other sages maintain that acts of sacriﬁce, charity and penance should never be abandoned.
Tapa generally means austerity like meditation, self control and other spiritual practices. The 17th chapter of Bhagavad Gita states the different types of tapa. They are: Satvic, Rajasic and Tamasic.
It is of three kinds, austerity of the body, of the speech and of the mind.
deva-dvija-guru-prājña-pūjanaṁ śaucam ārjavam
brahmacaryam ahiṁsā ca śārīraṁ tapa ucyate [BG - 17.14]
Worship of the Supreme Lord, the brāhmaṇas, the spiritual master, and superiors like the father and mother, and cleanliness, simplicity, celibacy and nonviolence are called austerity of the body.
anudvega-karaṁ vākyaṁ satyaṁ priya-hitaṁ ca yat
svādhyāyābhyasanaṁ caiva vāṅ-mayaṁ tapa ucyate [BG - 17.15]
Austerity of speech consists in speaking words that are truthful, pleasing, beneﬁcial, and not agitating to others, and also in regularly reciting Vedic literature.
manaḥ-prasādaḥ saumyatvaṁ maunam ātma-vinigrahaḥ
bhāva-saṁśuddhir ity etat tapo mānasam ucyate [BG - 17.16]
And satisfaction, simplicity, gravity, self-control and puriﬁcation of one’s existence are the austerities of the mind.
The threefold austerities in the mode of goodness are done with faith without any personal desires. [BG - 17.17] But the other two types of austerities are tainted with personal desires.
satkāra-māna-pūjārthaṁ tapo dambhena caiva yat
kriyate tad iha proktaṁ rājasaṁ calam adhruvam [BG - 17.18]
Penance performed out of pride and for the sake of gaining respect, honor and worship is said to be in the mode of passion. It is neither stable nor permanent.
mūḍha-grāheṇātmano yat pīḍayā kriyate tapaḥ
parasyotsādanārthaṁ vā tat tāmasam udāhṛtam [BG -17.19]
Penance performed out of foolishness, with self-torture or to destroy or injure others, is said to be in the mode of ignorance.
Tapas is endurance and acceptance. Alongwith Shri Krishna, Rishi Patanjali also talks about this in his Yoga Sutras. Here is a commentary on the same by Sri Sri Ravi Shankar:
Say you are traveling in a plane; it is a long-distance flight. You are sitting and your legs are getting numb. You are tired but you keep sitting. You feel heavy but still you keep sitting. You cannot say, "Oh! I cannot sit now. I am going to get out of the plane". No way. If the plane is delayed, held up in the air, you have to be there. There is no choice. Now, if you had a choice, then you would not sit for eight hours like that in one place. No way. But in a plane, you sit, accepting it willingly, without grumbling. That is tapaha.
Tapaha is really experiencing opposite values without grumbling. Do you get what I am saying? You are driving somewhere and you are feeling sleepy. Sleep time. You never mind, another two to three hours; you say, “It does not matter. I will reach home”. You will not say, “It is already 10 o’clock. It is my sleep time. I will sleep now”. You do not park your car somewhere and just go to sleep, unless it is absolutely unbearable.
In the same way, if you are hungry, you say, “No I am fasting. I want to have a cleansing diet. I want to cleanse my body. So I am just going to fast on juice or water”. You decide on your own to do some action which is not usual. That is tapaha. Are you getting what I am saying?
You know that it is beneficial, the result of this action is very good. “It is beneficial for me, I am going to do it”. Like doing exercise. People go to the gymnasium. It is not a joke, it is not giving them any pleasure doing that, lifting the weights. It is not a pleasurable job. Same with bicycling. But one does it. Why? They know that it is good for their system. This endurance is called tapaha.