Limit the number of records depends on the part of primary key
And I want to limit the number of referees on a single match to three,
  How can i do that?


One method is with a trigger:

CREATE TRIGGER tr_match_referee
ON dbo.match_referee
FOR INSERT, UPDATE AS
IF EXISTS(
    SELECT 1
    FROM inserted
    JOIN dbo.match_referee WITH (READCOMMITTEDLOCK) ON
        match_referee.id_match = inserted.id_match
    GROUP BY match_referee.id_match
    HAVING COUNT(*) &gt; 3
    )
BEGIN
    RAISERROR('No more than 3 referees allowed per match', 16, 1);
END;


Another approach is to add a column with a unique referee number per match along with a unique and check constraint. You would need to assign the referee number when assigning a ref to a match.

ALTER TABLE dbo.match_referee
    ADD match_referee_number int NOT NULL
    CONSTRAINT CK_match_referee_match_referee_number
    CHECK (match_referee_number BETWEEN 1 AND 3);
ALTER TABLE dbo.match_referee
    ADD CONSTRAINT UN_match_referee_id_match_match_referee_number
    UNIQUE(id_match, match_referee_number);