Electronic processes at grain boundaries in polycrystalline semiconductors under optical illumination