It is concluded in chapter 16 that scripture is our basis for determining what is to be done and what is not to be done. We should perform our duty in this world fully aware of the rules and regulations stated in the scripture.
Arjuna naturally wants to know about those who (ye) faithfully (śraddhayānvitāḥ) worship (yajante) while giving up the rules and regulations of the scriptures (śāstra-vidhim utsṛjya). What (kā) is but (tu) the status of their (teṣāṁ) faith (niṣṭhā)? Is it in goodness (sattvam), passion (rajas), or (āho) darkness (tamaḥ)? (BG 17.1)
The faith (śraddhā) of the embodied soul (dehināṁ), that is (sā) born of material nature (svabhāva-jā) is (bhavati) of three kinds (tri-vidhā) – good (sāttvikī), passionate (rājasī), and (caiva) dark (tāmasī). And thus (ceti), Krishna wants Arjuna to hear (śṛṇu) about that (tāṁ). (BG 17.2) Faith (śraddhā) exists (bhavati) for everyone (sarvasya) according to their existential nature (sattvānurūpā). A person (ayaṁ puruṣo) is considered to be permeated with faith (śraddhā-mayo). Whatever way one’s faith dictates (yo yac-chraddhaḥ) that is exactly what one is (sa eva saḥ). (BG 17.3)
Those in the mode of goodness (sāttvikā) worship (yajante) the gods (devān). Those in the mode of passion worship the yakṣas and rakṣāsas (yakṣa-rakṣāṁsi rājasāḥ). The yakṣas are celestial beings endowed with power and wealth and the rakṣāsas are powerful demons that evoke fear in others. And (ca), other (anye) people (janāḥ) who are in the mode of darkness (tāmasā) worship (yajante) ghosts (bhūta-gaṇāṁś) and spirits (pretān). (BG 17.4)
Krishna makes it clear that whimsically worshiping anyone or anything and even going through extreme austerities do not make one spiritual. Those who (ye janāḥ), accompanied with (saṁyuktāḥ) deceit (dambhā) and false ego (ahaṅkāra), and impelled by lust and attachment (kāma-rāga-balānvitāḥ), undergo (tapyante) severe (ghoraṁ) austerities (tapo) not recommended in the scriptures (aśāstra-vihitaṁ), thus mindlessly (acetasaḥ) tormenting (karṣayantaḥ) the material elements (bhūta-grāmam) situated in the body (śarīra-sthaṁ) and Krishna as well (māṁ caivā) who is internally (antaḥ) present within the body (śarīra-sthaṁ), are to be known as (tān viddhy) having demoniac resolve (āsura-niścayān). (BG 17.5-6)