25 Therefore Yahweh has rewarded me according to my righteousness, According to my cleanness in his eyesight.
*Minor differences ignored. Grouped by changes, with first version listed as example.
Therefore the Lord hath recompensed me according to my righteousness; according to my cleanness in his eye sight. See Gill on Psalm 18:24.
25 Thus Jehovah repaid me according to my righteousness,
According to my cleanness before His eyes.
26 Towards the pious Thou showest thyself pious,
Towards the perfectly innocent Thou showest thyself innocent.
27 Towards the genuine Thou showest thyself genuine,
And towards the perverse Thou showest thyself crooked.
28 And afflicted people Thou helpest,
And Thine eyes are against the haughty; them Thou humblest.
The motive for deliverance, which was expounded in 2-Samuel 22:21-24, is summed up briefly in 2-Samuel 22:25; and then in 2-Samuel 22:26 and 2-Samuel 22:27 it is carried back to the general truth, that the conduct of God towards men is regulated according to the conduct of men towards God. The vav cons. in ויּשׁב expresses the logical consequence. כּברי is used instead of ידי כּבר in 2-Samuel 22:21, which is repeated in the psalm simply for the sake of variation. The truth that God treats every man in accordance with his conduct towards Him, is expounded in four parallel clauses, in which the conduct of God is expressed in verbs in the Hithpael, formed from the adjectives used to describe the conduct of men towards God. To the חסיד, the pious or devoted to God, He also shows himself pious; and innocent, blameless, to the תמים גּבּור, the man strong in innocence, who walks in perfect innocence. נבר, a Niphal participle, from בּרר, he who keeps himself pure, strives after purity of walk. תּתּבר, an anomalous contraction of תּתבּרר (Ps.), analogous to the formation of נבר for נברר. The form תּתּפּל for תּתפּתּל, to show one's self perverse of crooked, is still more anomalous. God shows himself so towards the perverse, by giving him up to his perverseness (Romans 1:28). This general truth is applied in 2-Samuel 22:28 to the congregation of God, in the contrast which it presents of humble and haughty, and is expounded from the conduct of God, as displayed in the history of Israel, towards these two classes of men, into which the nation was divided. In the psalm, therefore, we find אתּה כּי, for which the simple ו is substituted here, because the verse does not contain any actual reason for what goes before. עני עם, afflicted people, is used to denote the pious and depressed in the nation; רמים, the high, i.e., the haughty, or godless rich and mighty in the nation. תּשׁפּיל is to be taken as a relative: whom Thou humblest (see Ewald, 332, b.; and for the thought, Isaiah 2:11). In the psalm the unusual mode of expression in the second clause is changed into the more common phrase, "Thou bringest down high, i.e., proud looks" (cf. Proverbs 6:17; Proverbs 21:4; Proverbs 30:13; Psalm 131:1, etc.).
*More commentary available at chapter level.