Previously the Apostle warned the Ephesians to abstain from wicked and injurious words (4:29). Here he advises them against words or actions which would upset or sadden other men. Regarding this he does two things:
First, he prohibits what is old.
Secondly, he encourages what pertains to the new (4:32).
Again the first part has two subdivisions:
First, he forbids what is old in general.
Secondly, he gets down to specific vices (4:31).
There might be an objection to his saying grieve not the Holy Spirit of God. The Holy Spirit is God in whom there can be no emotion or sorrow. I reply that t...he Holy Spirit is said to be grieved when that person is saddened in whom the Spirit dwells. "He that despiseth you, despiseth me" (Lk. 10:16). "But they provoked to wrath and afflicted the spirit of his Holy One: and he was turned to be their enemy" (Is. 63:10).
Or, it could be called a metaphorical expression. Just as God is said to be angry on account of the similarity of what he does to the results of human anger, so he could also be said to be grieved. When some person is saddened he withdraws from whoever is depressing him, likewise does the Holy Spirit withdraw from one who is sinning. Thus the meaning of "grieve not the Holy Spirit" is: do not chase him away or reject him through sin. "For the Holy Spirit of discipline will flee from the deceitful, and will withdraw himself from thoughts that are without understanding: and he shall not abide when iniquity cometh in" (Wis. 1:5).
Therefore, the Holy Spirit must not be saddened, and this on account of the blessing of his saving seal. Thus he adds whereby you are sealed, that is, you are reformed and set apart from others. Whoever possesses this seal shall enjoy eternal life. For this reason he must be held on to and in no way grieved since without him there is no life everlasting. "God also hath sealed us and given the pledge of the Spirit in our hearts" (2 Cor. 1:22). When did this happen? In the day of redemption, that is, of baptism. "Unless a man be born again of water and the Holy Spirit, he cannot enter into the kingdom of God" (Jn. 3:5). "You shall be baptized with the Holy Spirit not many days hence" (Ac. 1:5). He says redemption since in baptism a man becomes a sharer in the redemption accomplished by Christ.
Source: Commentary on Ephesians