can you rewrite this js script for tampermonkey and make him load targetwords from local file?

// ==UserScript==
// @name        markeks
// @namespace   markeks_text
// @match       *://iframe-toloka.com/*
// @grant       none
// @version     1.0
// @run-at      document-start
// @description 20/03/2023, 8:11:44 PM
// ==/UserScript==

(function () {
    'use strict';

    const targetWords = {
        red: [
            'word1',
            'word2',
        ],
        deepskyblue: [
            'word3',
            'word4',
        ],
        yellow: [
            'word5',
            'word6',
        ],
        lawngreen: [
            'word7',
            'word8',
        ],
    };

    const _escapeRegExp = /[.*+?^${}()|[\]\\]/g;
    function escapeRegExp(str) {
        return str.replace(_escapeRegExp, '\\$&');
    }

    for (const color in targetWords) {
        const list = targetWords[color];
        list.sort();
        const agg = {};
        for (const phrase of list) {
            const key = phrase.substring(0, 2).toLowerCase();
            if (!agg[key]) agg[key] = [];
            agg[key].push(escapeRegExp(phrase.substring(2)));
        }
        let regexArr = [];
        for (const key in agg) {
            try {
                if (agg[key].length > 1) regexArr.push(new RegExp(`${escapeRegExp(key)}(${agg[key].join('|')})`, 'ugi'));
                else regexArr.push(new RegExp(`${escapeRegExp(key)}${agg[key][0]}`, 'ugi'));
            } catch (e) {
                console.log(e);
            }
        }
        targetWords[color] = regexArr;
    }

    function replacer() {
        if (this && this.disconnect) this.disconnect();
        if (!document.body) {
            new MutationObserver(replacer).observe(document, { childList: true, subtree: true });
            return;
        }
        let matches;

        do {
            matches = [];

            const textNodes = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
            while (textNodes.nextNode()) {
                const node = textNodes.currentNode;
                const nodeText = node.nodeValue;
                if (node.parentNode._highlighted) continue;
                for (const color in targetWords) {
                    for (const wordRegExp of targetWords[color]) {
                        const match = wordRegExp.exec(nodeText);
                        if (match) {
                            const highlightEl = document.createElement('span');
                            highlightEl.className = `highlight-${color}`;
                            highlightEl.textContent = match[0];
                            highlightEl._highlighted = true;

                            const before = nodeText.substring(0, match.index);
                            const after = nodeText.substring(match.index + match[0].length);
                            matches.push([node, before, highlightEl, after]);
                            break;
                        }
                    }
                }
            }
            for (const match of matches) {
                const [node, before, highlightEl, after] = match;
                const parent = node.parentNode;
                if (!parent) continue;
                parent.insertBefore(document.createTextNode(before), node);
                parent.insertBefore(highlightEl, node);
                parent.insertBefore(document.createTextNode(after), node);
                parent.removeChild(node);
            }
        } while (matches.length);

        let styles = '';
        for (const color in targetWords) {
            styles += `.highlight-${color} { background-color: ${color} !important; }\n`;
        }
        const highlightStyle = document.createElement('style');
        highlightStyle.textContent = styles;
        document.head.appendChild(highlightStyle);

        new MutationObserver(replacer).observe(document, { childList: true, subtree: true });
    }
    replacer();
})();