Before starting any prayer it is required that we light a lamp which is made up of oil and cotton wick. But it is considered uttam (best) if ghee (Clarified butter) is used instead of oil. Why is ghee considered uttam?
As you pointed 'ghee' is considered as the best for lighting lamps in houses and also in temples. This is the product extracted from milk of cows, which is considered sacred. Ghee is one of the purest form of milk which is extracted from the butter. As we all know cow milk has some medicinal qualities. Since ghee is the purest form of milk, it will have it's highest qualities. When we use ghee lamp it helps to purify the atmosphere.
The following information is taken from this reference
"Agni Puran clearly states that only oil or Ghee (clarified butter) be used in the lamp meant for puja and no other combustible substance. According to the Science of spirituality the lamp with clarified butter is more sattvik (spiritually pure) as compared to lamp in which oil is used.
Generally the use of oil is more prevalent than that of Ghee. The oil containing lamp kindles longer while the ghee containing lamp kindles for a short period.
- Ghee lamp has more capacity to attract the sattvik vibrations present in the surrounding atmosphere as compared to oil lamp.
- The oil lamp can attract the sattvik vibrations spread over a maximum distance of 1 meter while the ghee lamp can attract sattvik vibrations spread over till Swarga Lok (heaven)
- When the oil lamp stops burning the predominance of raja particles in the atmosphere is enhanced and lasts for half an hour. On the other hand when the ghee lamp stops burning the impact of sattvikta (the quality of being sattvik) on the atmosphere is experienced even after four hours.
Effect on the worshipper as per Kundalini Yog
According to yogic path of Kundalini Yog there are seven principle chakras or energy centers in the human being. These chakras influence practically every aspect of human being including physical body, mind and intellect. The oil lamp is effective in purification of Muladhar and Swadhishthan Chakra only to certain extent but the ghee lamp purifies Manipur and Anahat chakras to a significant extent. Just as there are seven chakras in the human body, there are paths for the flow of vital energy (chetana). These are called as Nadis or channels. The three principle nadis are Chandra nadi (Moon channel), Surya nadi (Sun channel) and Sushumna nadi. When Chandra nadi is active the person perceives coolness. The activation of Surya nadi imparts energy to the person. The Sushumna nadi is activated when the person starts progressing spiritually. The oil lamp activates the Surya nadi of the person while ghee lamp activates only that nadi which is essential to the worshipper in a particular action.
Effect on the subtle sheaths of the worshipper
According to the science of spirituality the body which is visible to our eyes is called Annamaya Kosha or food sheath. Besides this there are four other Koshas namely Pranmaya Kosha or vital air sheath, Manomaya Kosha or the mental sheath, Vidnyanmaya Kosha or sheath of intellect and Anandmaya Kosha or bliss sheath. The Pranmaya kosha is a seat for the Pancha pranas (five vital air elements) which provides energy to the gross body. The second Manomaya kosha is the seat of emotions. The third Vidnyanmaya Kosha is the seat of intellect and the fourth Anandamaya Kosha is the seat of Soul which is of the nature of existence, consciousness and bliss (satchidananda). Even these subtle sheaths or koshas are affected by the oil or ghee lamps. The oil lamp imparts power to the raja particles in the Pranamaya kosha which makes the individual restless. The ghee lamp strengthens the sattva particles of Pranamaya kosha and Manomaya Kosha and as a result of this the jiva (individual, embodied soul) becomes peaceful,stable and happy.
Spiritual experience imparted by oil and ghee lamps
When we see subtle light or vision of a deity then it is an example of spiritual experience related to Tej tattva or absolute fire element. When we experience a feeling of touch without any external reason then it is a spiritual experience related to Vayu tattva or absolute air element. The ghee lamp gives spiritual experience of Tej tatva and Vayu tattva to the worshipper."
Lamps / Diya we say have special meaning in Hindu dharma.
Lightness is a symbol of knowledge which in a way removes ignorance amongst humans, just as light removes darkness.
Since old days, people lit lamps around their homes, in temples etc just to ignore darkness because some people relate darkness with evil spirits, bad demons etc.
Some ignore doing (shubh) [Good] (karya) [work] in darkness, and hence they do it in the early morning (when there's light[prakash])
I would like to share a snippet from Sanskrit
असतोमा सद्गमय। तमसोमा ज्योतिर् गमया। मृत्योर्मामृतं गमय॥ ॐ शांति शांति शांति - बृहदारण्यक उपनिषद् 1.3.28.
Here, the sentence I have highlighted is pronounced as "Tamso maa jyotir gamaya" which means From darkness, lead me to light.
Now why do we use Ghee and why not candles? Ghee which is made out of cows milk is preferred or in your words, its considered as uttam as it spreads vibrations which helps human talk with Gods and Godesses.
There is a difference between lighting a lamp with ghee, oil and candles, I already explained you about the ghee, but when one lits the lamp with oil, it spreads the vibration which helps you talk with your ancestors.
And the one which lits up with candles spreads vibrations which helps one communicate with Evil spirits(Demons). Hence when you see, some people do black magic tricks to interact with the souls (Aatma) they use candles while doing so.
Also, as far as I remember, recently I visited Tirupati mandir, where they still don't use artificial lights in the inner main room where they've kept lord Tirupati's murthi, they use diya instead which is nothing but a natural form of light.
To support my answer, I would like to link to a similar article which has similar views over this and is covered in detail
Ghee lamp is preferred because it has scientific properties. The fumes which come out of Ghee lamp kills several types of viruses in the atmosphere, same as Hawan(Yagna) ingredients. In Yagna ingredients also, similar things are used which are capable of killing environmental viruses when burned. Dhoop sticks also contain the same properties.