Your question seems to pertain to those things in which Catholics are obliged to give their assent. Infallible dogma falls into this category. However, even the ordinary teaching or doctrine of the Magisterium not infallibly defined also falls into this category, according to the Dogmatic Constitution on the Church, Lumen Gentium:
In matters of faith and morals, the bishops speak in the name of Christ and the faithful are to accept their teaching and adhere to it with a religious assent. This religious submission of mind and will must be shown in a special way to the authentic magisterium of the Roman Pontiff, even when he is not speaking ex cathedra; that is, it must be shown in such a way that his supreme magisterium is acknowledged with reverence, the judgments made by him are sincerely adhered to, according to his manifest mind and will. His mind and will in the matter may be known either from the character of the documents, from his frequent repetition of the same doctrine, or from his manner of speaking. (Lumen Gentium, 25).
The Code of Canon law likewise states:
Canon 752 While the assent of faith is not required, a religious submission of intellect and will is to be given to any doctrine which either the Supreme Pontiff or the College of Bishops, exercising their authentic magisterium, declare upon a matter of faith or morals, even though they do not intend to proclaim that doctrine by definitive act. Christ’s faithful are therefore to ensure that they avoid whatever does not accord with that doctrine. …
Canon 1371 The following are to be punished with a just penalty:
1° a person who, apart from the case mentioned in Canon 1364 §1 , teaches a doctrine condemned by the Roman Pontiff, or by an Ecumenical Council, or obstinately rejects the teaching mentioned in Canon 752 and, when warned by the Apostolic See or by the Ordinary, does not retract;
2° a person who in any other way does not obey the lawful command or prohibition of the Apostolic See or the Ordinary or Superior and, after being warned, persists in disobedience.
Cardinal Ratzinger (then prefect of the Congregation for the Doctrine of Faith) published the following doctrinal commentary related to the above paragraph:
To this [third] paragraph belong all those teachings on faith and morals - presented as true or at least as sure
, even if they have not been defined with a solemn judgment or proposed as definitive by the ordinary and universal Magisterium. Such teachings are, however, an authentic expression of the ordinary Magisterium of the Roman Pontiff or of the College of Bishops and therefore ***require religious submission of will and intellect.*** They are set forth in order to arrive at a deeper understanding of revelation, or to recall the conformity of a teaching with the truths of faith, or lastly to warn against ideas incompatible with these truths or against dangerous opinions that can lead to error.
A proposition contrary to these doctrines can be qualified as erroneous or, in the case of teachings of the prudential order, as rash or dangerous and therefore "tuto doceri non potest".
As examples of doctrines belonging to the third paragraph, one can point in general to teachings set forth by the authentic ordinary Magisterium in a non-definitive way, which require degrees of adherence differentiated according to the mind and the will manifested; this is shown especially by the nature of the documents, by the frequent repetition of the same doctrine, or by the tenor of the verbal expression.38
18 Cf. Second Vatican Ecumenical Council, Dogmatic Constitution Lumen Gentium, 25; Congregation for the Doctrine of the Faith, Instruction Donum Veritatis, 23: AAS 82 (1990), 1559-1560.
19 Cf. Congregation for the Doctrine of the Faith, Instruction Donum Veritatis, 23 and 24: AAS 82 (1990), 1559-1561.
20 Cf. CIC, cann. 752, 1371; CCEO, cann. 599, 1436 § 2.
38 Cf. Second Vatican Ecumenical Council, Dogmatic Constitution Lumen Gentium, 25; Congregation for the Doctrine of the Faith, Instruction Donum Veritatis, 17, 23 and 24: AAS 82 (1990), 1557-1558, 1559-1561.
To the question whether obstinate refusal to obey canon 752 is a “grave” sin, any violation of law associated with a “penalty” (i.e., penance) is normally considered grave, because sins which are merely venial do not require penance.