О каких элементах идёт речь:
const className = 'intro';
.
Можно приводить текст элемента и строку, по которой выполняется поиск, к общему регистру:
function setHighlight(value) {
value = value.toLowerCase();
for (const n of document.getElementsByClassName(className)) {
const matched = value && n.innerText.toLowerCase().includes(value);
n.style.backgroundColor = matched ? 'silver' : '';
}
}
Или, воспользоваться регулярным выражением, нечувствительным к регистру:
.highlight {
background-color: silver;
}
function setHighlight(value) {
let test = () => false;
if (value) {
try {
test = RegExp.prototype.test.bind(RegExp(value, 'i'));
} catch (e) {}
}
document.querySelectorAll(`.${className}`).forEach(n => {
n.classList.toggle('highlight', test(n.textContent));
});
}